/**********************************************************************
*  Copyright (c) 2007 - Victor Jacobs - victor.jacobs@gmail.com
*
*  Permission is hereby granted, free of charge, to any person
*  obtaining a copy of this software and associated documentation
*  files (the "Software"), to deal in the Software without
*  restriction, including without limitation the rights to use,
*  copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the
*  Software is furnished to do so, subject to the following
*  conditions:
*
*  The above copyright notice and this permission notice shall be
*  included in all copies or substantial portions of the Software.
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
*  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
*  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
*  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
*  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
*  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
*  OTHER DEALINGS IN THE SOFTWARE.
**********************************************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections.Specialized;
using Vj.MathLibrary;

namespace Vj.ShapeLibrary.ObjConverter
{
    public class ObjShape
    {
        protected Vector[] vertexArray;
        protected Vector[] texCoordArray;
        protected Vector normal;

        public Vector[] VertexArray
        {
            get { return vertexArray; }
            set 
            {
                if (value == null)
                    throw new ArgumentNullException();
    
                vertexArray = value; 
            }
        }

        public Vector Normal
        {
            get { return normal; }
            set { normal = value; }
        }

        public Vector[] TexCoordArray
        {
            get { return texCoordArray; }
            set 
            { texCoordArray = value; }
        }
    
        public ObjShape(Vector[] vertexArray, Vector normal, Vector[] texCoordArray)
        {
            if (vertexArray == null)
                throw new ArgumentNullException();

            this.vertexArray = vertexArray;
            this.texCoordArray = texCoordArray;
            this.normal = normal;
        }
    }

    public class ObjModel
    {
        private List<Vector> vertexList;
        private List<Vector> normalList;
        private List<Vector> texCoordList;
        private List<ObjShape> shapeList;

        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public List<Vector> VertexList
        {
            get { return vertexList; }
            set { vertexList = value; }
        }

        public List<Vector> NormalList
        {
            get { return normalList; }
            set { normalList = value; }
        }

        public List<Vector> TexCoordList
        {
            get { return texCoordList; }
            set { texCoordList = value; }
        }

        public List<ObjShape> ShapeList
        {
            get { return shapeList; }
            set { shapeList = value; }
        }

        public ObjModel(string name, List<Vector> vertexList, List<Vector> normalList,
            List<Vector> texCoordList, List<ObjShape> shapeList)
        {
            this.name = name;
            this.vertexList = vertexList;
            this.normalList = normalList;
            this.texCoordList = texCoordList;
            this.shapeList = shapeList;
        }

        public ObjModel()
        {
            this.name = "";
            this.vertexList = new List<Vector>();
            this.normalList = new List<Vector>();
            this.texCoordList = new List<Vector>();
            this.shapeList = new List<ObjShape>();
        }
         
    }
}
